import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
// 全局引入公共样式
import '@/styles/common.scss'
// 引入全局指令插件
import { lazyLoadPlugin } from '@/directives/index'
// 引入全局组件插件
import { componentPlugin } from '@/components/index'

const app = createApp(App)
// 创建pinia实例
const pinia = createPinia()
// pinia实例使用持久化插件
pinia.use(piniaPluginPersistedstate)
app.use(pinia)
app.use(router)
app.use(lazyLoadPlugin)
app.use(componentPlugin)
app.mount('#app')
// 注册所有图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
